const fp = require("lodash/fp");
//data
const cars = [
  { name: "Fer", housepower: 100, dollar_value: 7000, in_stock: true },
  { name: "Spy", housepower: 600, dollar_value: 7000, in_stock: false },
  { name: "Jag", housepower: 700, dollar_value: 11000, in_stock: true },
];
//tips:获取最后一条数据的in_stock属性
//1
const f = fp.flowRight(fp.props("in_stock"), fp.last);
// console.log(f(cars));
//2
const f2 = fp.flowRight(fp.props("name"), fp.first);
// console.log(f2(cars));
//3
//4

let _underscore = fp.replace(/\s+/g, "_");
const Log = (v) => {
  console.log(v);
  return v;
};
const f4 = fp.flowRight(fp.replace(/\W+/g, "_"), Log, fp.toLower);
console.log(f4("Hello World"));

// 三
// 1.
let ex1 = () => {
  maybe().map((x) => x.map((item) => item + 1));
};
//2.
let ex2 = () => {
  maybe().map((x) => x.first);
};
//3.
let ex3 = () => {};
//4
